<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<title>生产计划</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../res/css/layui.css" media="all">
<link rel="stylesheet" href="../../res/css/cst/snproduction.css"
	media="all">
<script type="text/javascript" src="../../res/js/jquery-1.11.2.min.js"></script>
<style>
#manuTableTwo tr td, #manuTableTwo tr th {
	text-align: center;
}

#purchase {
	margin-bottom: 40px;
}

.manuNumber {
	width: 200px;
	height: 28px;
	border: none;
	text-align: center;
	color: gray;
	opacity: 0.8;
}

.manuSum {
	width: 200px;
	height: 28px;
	border: none;
	text-align: center;
}
</style>
</head>
<body>

	<div class="demoTable" style="margin-left: 20px; margin-top: 10px;">
		操作人:
		<div class="layui-inline">
			<input class="layui-input" style="height: 32px;" id="oper" maxlength="7" placeholder="请输入操作人:"
				autocomplete="off" lay-verify="oper">
		</div>
		开始时间：
		<div class="layui-inline">
			<input class="layui-input" style="height: 32px;" name="id" id="date"
				placeholder="yyyy-MM-dd" autocomplete="off">
		</div>
		-截止时间:
		<div class="layui-inline">
			<input class="layui-input" name="id" id="time" style="height: 32px;"
				placeholder="yyyy-MM-dd" autocomplete="off">
		</div>
		状态:
		<from class="layui-form">
		<div class="layui-inline">
			<select lay-filter="aihao" id="state"
				style="width: 100px; border: 1px solid red;">
				<option value="">====请选择====</option>
				<option value="0">等待提交审核</option>
				<option value="1">等待审核</option>
				<option value="2">等待生产</option>
				<option value="3">生产中</option>
				<option value="4">生产完成</option>
				<option value="5">等待质检</option>
				<option value="6">质检完成</option>
			</select>
		</div>
		</from>


		<button class="layui-btn layui-btn-sm" data-type="reload"
			id="selectButton">搜索</button>
		<button class="layui-btn layui-btn-warm layui-btn-sm" id="insert">增加</button>

	</div>

	<table class="layui-table"
		lay-data="{ url:'../../production/findAll.action', page:true, id:'idTest'}"
		lay-filter="demo">
		<thead>
			<tr>
				<th lay-data="{type:'checkbox', fixed: 'left'}"></th>
				<th lay-data="{field:'proId',align:'center',width:'220'}">生产ID</th>
				<th
					lay-data="{field:'proDate',width:'160',sort: true, align:'center'}">开始时间</th>
				<th
					lay-data="{field:'proTime',width:'160', align:'center', sort: true}">截止时间</th>
				<th lay-data="{field:'oper', width:'104',align:'center'}">操作人</th>
				<th lay-data="{field:'optime',width:'160', align:'center'}">操作时间</th>
				<th
					lay-data="{field:'proState',width:'150', align:'center',templet:'#imgTpl'}">生产状态</th>
				<th
					lay-data="{fixed: 'right',width:'500',fixed: 'right', align:'center', toolbar: '#barDemo'}">操作</th>
			</tr>
		</thead>
	</table>


	<script type="text/javascript" id="imgTpl">
	{{# if(d.proState == 0) { }}
		<div>等待提交审核</div>
	{{# }else if(d.proState == 1) { }}
		<div>等待审核</div>
 	{{# }else if(d.proState == 2) { }}
     <div>等待生产</div>
 	 {{# } else if(d.proState == 3){ }}
    <div>生产中</div>
	 {{# } else if(d.proState == 4){ }}
		<div>生产完成</div>
	{{# }else if(d.proState == 5){ }}
    	<div>等待质检</div>
	 {{# }else if(d.proState == 6){ }}
 		<div>质检完成</div>
	 {{# }}}
</script>

	<script type="text/html" id="barDemo">
	{{# if(d.proState == 0) { }}
     <button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button>
	 <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>
 	 <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="detail">添加详情</button>
 	{{# } else{ }}
     <button class="layui-btn layui-btn-disabled layui-btn-xs">编辑</button>
	 <button class="layui-btn layui-btn-disabled layui-btn-xs">删除</button>
 	 <button class="layui-btn layui-btn-xs layui-btn-disabled">添加详情</button>
	{{# }}}

	
	{{# if(d.proState == 0) { }}
     	<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="audit">提交审核</button>
 	{{# }else if(d.proState == 1){ }}
		<button class="layui-btn layui-btn-xs layui-btn-disabled">等待审核</button>
	{{# }else{ }}
		<button class="layui-btn layui-btn-xs layui-btn-disabled">审核通过</button>
	{{# }}}

	
    {{# if(d.proState == 3) { }}
     	<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="accomplish">制作完成</button>
 	{{# } else if(d.proState >3){ }}
    	<button class="layui-btn layui-btn-xs layui-btn-disabled">制作完成</button>
	{{# } else if(d.proState ==2){ }}
		<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="make">开始制作</button>
	{{# }else{ }}
		<button class="layui-btn layui-btn-xs layui-btn-disabled">开始制作</button>
	{{# }}}
  
{{# if(d.proState == 4) { }}
	<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="addQuality">提交质检</button>
{{# } else if(d.proState == 5){}}
	<button class="layui-btn layui-btn-xs layui-btn-disabled">等待质检</button>
{{# } else if( d.proState == 6 ){}}
	<button class="layui-btn layui-btn-xs layui-btn-disabled">质检完成</button>
{{# }else{ }}
	<button class="layui-btn layui-btn-xs layui-btn-disabled">提交质检</button>
{{#}}}
  
  <button id="fix" class="layui-btn layui-btn-xs" lay-event="cxdetail">查看详情</button>

	
</script>

	<!-- 增加或修改的弹框 -->
	<div id="addOrUpdate" style="display: none;">
		<form id="myform" class="layui-form" method="post"
			action="<%=basePath %>SiteServlet?action=submit"
			style="margin-top: 10px;">
			<input type="hidden" name="proId" id="proId" />
			<div class="aru">
				<label class="layui-form-label">开始时间:</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input"  id="opDate" name="proDate" lay-filter="opDate"
						placeholder="yyyy-MM-dd HH:mm:ss">
					<input type="hidden" class="inputYz" id="opDateInput">
				</div>
			</div>

			<div class="aru">
				<label class="layui-form-label">截止时间:</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" id="opTime" name="proTime" 
						placeholder="yyyy-MM-dd HH:mm:ss">
					<input type="hidden" class="inputYz" id="opTimeInput">
				</div>
			</div>


			<div class="aru">
				<div class="layui-input-block">
					<input type="button" class="layui-btn" id="sub" value="确认提交" /> <a
						href="javascript:exit();" class="layui-btn layui-btn-danger">关闭</a>
				</div>
			</div>
		</form>
	</div>
	<!-- 查看详情 -->
	<div id="cxDetailDiv" style="display: none;">
		<input type="hidden" id="cxDetailDivProId">

		<table id="myTable" class="layui-table"
			lay-data="{ url:'../../prodetail/findDuction.action', page:true, id:'cxDetailTable'}"
			lay-filter="myTableDemo">
			<thead>
				<tr>
					<th lay-data="{field:'comName',align:'center',width:'195'}">商品名称</th>
					<th lay-data="{field:'deNumber', align:'center',width:'100'}">总生产数量</th>
					<th lay-data="{field:'deStocks', align:'center',width:'100'}">已完成数量</th>
					<th lay-data="{field:'deUndone', align:'center',width:'100'}">未完成数量</th>
					<th
						lay-data="{field:'optime', align:'center', sort: true,width:'200'}">操作时间</th>
					<th lay-data="{field:'deCount', align:'center', width:'100'}">生产次数</th>
				</tr>
			</thead>
		</table>
	</div>
	<div id="manufactureDiv" style="display: none;">

		<div class="demoTable" style="margin-left: 20px; margin-top: 20px;">
			商品名称:
			<div class="layui-inline">
				<input class="layui-input" style="height: 32px;" id="comNameInput"
					autocomplete="off" placeholder="请输入商品名称">
			</div>
			<button class="layui-btn layui-btn-sm" data-type="manuSelect"
				id="selectButton">搜索</button>
			<button class="layui-btn layui-btn-danger layui-btn-sm"
				onclick="manuExit()">取消</button>
		</div>


		<table class="layui-table"
			lay-data="{ url:'../../snmanufacture/findAll.action', page:true, id:'manuTable'}"
			lay-filter="manuTableDemo">
			<thead>
				<tr>
					<th lay-data="{field:'comName',align:'center'}">商品名称</th>
					<th lay-data="{field:'smNumber', align:'center'}">预计生产数量</th>
					<th lay-data="{field:'smStocks', align:'center'}">已完成数量</th>
					<th lay-data="{field:'smUndone', align:'center'}">未完成数量</th>
					<th lay-data="{field:'smState', align:'center', sort: true,toolbar: '#manState'}">制作状态</th>
					<th lay-data="{field:'oper', align:'center'}">生产次数</th>
				</tr>
			</thead>
		</table>
		<script type="text/javascript" id="manState">
	{{# if(d.smState == 0) { }}
		<div>未完成</div>
	{{# } else if(d.smState == 1){}}
		<div>已完成</div>
	{{# }}}
	</script>
		<div class="demoTable" style="margin-left: 20px; margin-top: 20px;">
			<button class="layui-btn layui-btn-sm" data-type="manuBao" id="selectButton">确认保存</button>
		</div>

		<table class="layui-table" id="manuTableTwo"
			lay-filter="manuTableTwoDemo">
			<thead>
				<tr>
					<th>商品名称</th>
					<th>等待生产数量</th>
					<th>完成数量</th>
				</tr>
			</thead>
			<tbody id="manuTableTwoBody">

			</tbody>
		</table>

	</div>
	<script src="../../res/layui.all.js" charset="utf-8"></script>
	<script type="text/javascript" src="../../res/js/cst/snproduction.js"></script>
</body>
</html>